@extends('layouts.back_stage')
@section('content')
    <style>
        .tableBg{padding:30px;background:#fff;}
        .shopBg{background:#fff;overflow: hidden;margin:20px 0 10px 0;}
        .pagination-box{text-align: center;box-sizing:border-box;margin-top:20px;}
        .input-item{width:200px;padding-right: 0;}
        ::-webkit-scrollbar {height: 8px;}
        .el-table__footer-wrapper tbody td, .el-table__header-wrapper tbody td{color:red;}
        .el-select .el-input .el-select__caret.el-input__icon{line-height:22px;}
        .el-table thead.is-group th{padding:0 !important;}

        .el-table--mini.tbDaes td{padding:0 !important;}
        [v-cloak] {display: none;}
        .el-table .bgPink {color: #cd6ade;}
        .el-table .bgBlue{color: #4147ff;}
        .el-table .bgRed{color: #f32513;}
    </style>
    <div class="container">
        <div style="padding:20px 20px 20px 0;overflow:hidden;"><h3 style="float:left;">客户订发存</h3></div>
        <!-- 主体-->
        <div class="page-body">
            <div class="row app" id="shopInfos" v-cloak>
                <div class="col-md-12 row row-table-box">
                    <div class="shopBg">
                        <div class="row" style="margin-top:10px;padding:26px 30px;min-height:90px;background:#fff;">
                            <label>公司：</label>
                            <el-select v-model="company_id" filterable placeholder="请选择公司" size="small" style="width:200px;">
                                <el-option v-for="item in options1" :key="item.id" :label="item.company_name" :value="item.id"></el-option>
                            </el-select>

                            {{--<label>时间：</label>--}}
                            {{--<el-date-picker v-model="getDatas" @change="getTime" type="daterange" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" size="small"></el-date-picker>--}}
                            <el-button type="primary" size="small" @click="sou('reset')">搜索</el-button>
                            <el-button type="primary" size="small" @click="resetSou('reset')">重置</el-button>
                        </div>
                    </div>
                    <div class="tableBg" style="margin-top:10px;">
                        <el-tabs v-model="activeName2" type="border-card" @tab-click="handleClick">
                            <el-tab-pane label="按款订发存明细" name="first">
                                <el-table :data="girardDetails" class="tbDaes" max-height="510" size="mini" style="width: 100%;" border :summary-method="getSummaries1" show-summary :span-method="objectSpanMethod1">
                                    <el-table-column prop="loop" label="序号" width="50" :resizable='false'></el-table-column>
                                    <el-table-column prop="cate_1" label="大类" width="50" :resizable='false'></el-table-column>
                                    <el-table-column prop="cate_2" label="中类" width="75" :resizable='false'></el-table-column>
                                    <el-table-column prop="cate_3" label="小类" width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="brand" label="品牌" width="90" :resizable='false'></el-table-column>
                                    <el-table-column prop="girard" label="款号" width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="color" label="颜色" width="75" :resizable='false'></el-table-column>
                                    <el-table-column prop="price" label="吊牌价/元" align="right" width="130" :resizable='false'></el-table-column>

                                    <el-table-column v-for="item in sizeGr"  :label="item.key76" width="70" :resizable='false'>
                                        <el-table-column :label="item.key75" width="70" :resizable='false'>
                                            <el-table-column :label="item.key79" width="70" :resizable='false'>
                                                <el-table-column :label="item.key154" width="70" :resizable='false'>
                                                    <el-table-column :label="item.key146" width="70" :resizable='false'>
                                                        <el-table-column :label="item.key161" width="70" :resizable='false'>
                                                            <el-table-column :label="item.key77" width="70" :resizable='false'>
                                                                <el-table-column :prop="item.key_0" :label="item.key140" width="70" :resizable='false'></el-table-column>
                                                            </el-table-column>
                                                        </el-table-column>
                                                    </el-table-column>
                                                </el-table-column>
                                            </el-table-column>
                                        </el-table-column>
                                    </el-table-column>
                                    <el-table-column prop="sum_nums1" label="订货合计/件" width="120" :resizable='false'></el-table-column>
                                    <el-table-column prop="sum_nums2" label="已发合计/件" width="120" :resizable='false'></el-table-column>
                                    <el-table-column prop="sum_nums3" label="开单合计/件" width="120" :resizable='false'></el-table-column>
                                    <el-table-column prop="sum_nums4" label="剩余合计/件" width="120" :resizable='false'></el-table-column>
                                    <el-table-column prop="sum_nums5" label="可用库存/件" width="120" :resizable='false'></el-table-column>
                                    <el-table-column prop="sum_nums6" label="仓库余量/件" width="120" :resizable='false'></el-table-column>
                                </el-table>
                                <div class="pagination-box">
                                    <el-pagination @size-change="handleSizeChange1" :page-sizes="[10,50,100,200]" :page-size="10" @current-change="changePageSkip1" :current-page.sync="currentPage1" :total="total1" layout="sizes,prev, pager, next" background></el-pagination>
                                </div>
                            </el-tab-pane>
                            <el-tab-pane label="按客户订发存明细" name="second">
                                <el-table :data="girardPeople" class="tbDaes" max-height="510"  size="mini" style="width: 100%;" border :summary-method="getSummaries2" show-summary :span-method="objectSpanMethod2">
                                    <el-table-column prop="loop" label="序号" width="50" :resizable='false'></el-table-column>
                                    <el-table-column prop="client_name" label="客户名称" width="120" :resizable='false'></el-table-column>
                                    <el-table-column prop="cate_1" label="大类" width="50" :resizable='false'></el-table-column>
                                    <el-table-column prop="cate_2" label="中类" width="75" :resizable='false'></el-table-column>
                                    <el-table-column prop="cate_3" label="小类" width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="brand" label="品牌" width="90" :resizable='false'></el-table-column>
                                    <el-table-column prop="girard" label="款号" width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="color" label="颜色" width="75" :resizable='false'></el-table-column>
                                    <el-table-column prop="price" label="吊牌价/元" align="right" width="130" :resizable='false'></el-table-column>

                                    <el-table-column v-for="item in sizeGr"  :label="item.key76" width="70" :resizable='false'>
                                        <el-table-column :label="item.key75" width="70" :resizable='false'>
                                            <el-table-column :label="item.key79" width="70" :resizable='false'>
                                                <el-table-column :label="item.key77" width="70" :resizable='false'>
                                                    <el-table-column :prop="item.key_0" :label="item.key140" width="70" :resizable='false'></el-table-column>
                                                </el-table-column>
                                            </el-table-column>
                                        </el-table-column>
                                    </el-table-column>
                                    <el-table-column prop="sum_nums1" label="订货合计/件" width="120" :resizable='false'></el-table-column>
                                    <el-table-column prop="sum_nums2" label="已发合计/件" width="120" :resizable='false'></el-table-column>
                                    <el-table-column prop="sum_nums3" label="开单合计/件" width="120" :resizable='false'></el-table-column>
                                    <el-table-column prop="sum_nums4" label="剩余合计/件" width="120" :resizable='false'></el-table-column>
                                </el-table>
                                <div class="pagination-box">
                                    <el-pagination @size-change="handleSizeChange2" :page-sizes="[10,50,100,200]" :page-size="10" @current-change="changePageSkip2" :current-page.sync="currentPage2" :total="total2" layout="sizes,prev, pager, next" background></el-pagination>
                                </div>
                            </el-tab-pane>
                            <el-tab-pane label="按类订发存分析" name="third">
                                <el-table :data="surplusInfo" max-height="510"  size="mini" style="width: 100%;" border :summary-method="getSummaries3" show-summary :header-cell-class-name="handlemyclass">
                                    <el-table-column prop="loop" label="序号" width="50" :resizable='false'></el-table-column>
                                    <el-table-column prop="client_name" label="客户名称" width="140" :resizable='false'></el-table-column>
                                    <el-table-column v-for="(item,index) in cateTwo" :key="index" :label="item.text" width="70" align="center" :resizable='false'>
                                        <el-table-column :prop="item.arguments0" label="订货量/件" width="100" :resizable='false'></el-table-column>
                                        <el-table-column :prop="item.arguments1" label="订货额/元" width="100" :resizable='false'></el-table-column>
                                        <el-table-column :prop="item.arguments2" label="发货量/件" width="100" :resizable='false'></el-table-column>
                                        <el-table-column :prop="item.arguments3" label="发货额/元" width="100" :resizable='false'></el-table-column>
                                        <el-table-column :prop="item.arguments4" label="剩余量/件" width="100" :resizable='false'></el-table-column>
                                        <el-table-column :prop="item.arguments5" label="剩余额/元" width="100" :resizable='false'></el-table-column>
                                    </el-table-column>
                                </el-table>
                                <div class="pagination-box">
                                    <el-pagination @size-change="handleSizeChange3" :page-sizes="[10,50,100,200]" :page-size="10" @current-change="changePageSkip3" :current-page.sync="currentPage3" :total="total3" layout="sizes,prev, pager, next" background></el-pagination>
                                </div>
                            </el-tab-pane>
                            <el-tab-pane label="客户订发存订单" name="fourth">
                                <el-table :data="orderInfo" max-height="510"  size="mini" style="width: 100%;" border :summary-method="getSummaries4" show-summary>
                                    <el-table-column prop="loop" label="序号" width="50" :resizable='false'></el-table-column>
                                    <el-table-column prop="client" label="客户名称" min-width="160" :resizable='false'></el-table-column>
                                    <el-table-column prop="cate_1" label="大类" width="50" :resizable='false'></el-table-column>
                                    <el-table-column prop="cate_2" label="中类" width="75" :resizable='false'></el-table-column>
                                    <el-table-column prop="cate_3" label="小类" width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="brand" label="品牌" width="90" :resizable='false'></el-table-column>
                                    <el-table-column prop="girard" label="款号" width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="color" label="颜色" width="75" :resizable='false'></el-table-column>
                                    <el-table-column prop="size" label="尺码" width="50" :resizable='false'></el-table-column>

                                    <el-table-column prop="order_num" label="订货数量/件" width="120" :resizable='false'></el-table-column>
                                    <el-table-column prop="send_num" label="已发数量/件" width="120" :resizable='false'></el-table-column>
                                    <el-table-column prop="kai_num" label="已开单数量/件" width="120" :resizable='false'></el-table-column>
                                    <el-table-column prop="sheng_num" label="剩余数量/件" width="120" :resizable='false'></el-table-column>
                                    <el-table-column prop="storage_num" label="公司库存/件" width="120" :resizable='false'></el-table-column>
                                    <el-table-column prop="sur_num" label="可配库存/件" width="120" :resizable='false'></el-table-column>
                                </el-table>
                                <div class="pagination-box">
                                    <el-pagination @size-change="handleSizeChange4" :page-sizes="[10,50,100,200]" :page-size="10" @current-change="changePageSkip4" :current-page.sync="currentPage4" :total="total4" layout="sizes,prev, pager, next" background></el-pagination>
                                </div>
                            </el-tab-pane>
                            {{--<el-tab-pane label="下属店铺订发存清单" name="fifth">--}}
                                {{--<el-table :data="underlingInfo" max-height="510"  size="mini" style="width: 100%;" border :summary-method="getSummaries5" show-summary>--}}
                                    {{--<el-table-column prop="loop" label="序号" width="50" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="people" label="客户名称" width="120" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="cate_1" label="大类" width="50" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="cate_2" label="中类" width="75" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="cate_3" label="小类" width="100" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="brand" label="品牌" width="90" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="girard" label="款号" width="100" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="color" label="颜色" width="75" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="size" label="尺码" width="50" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="count" label="订货数量/件" width="120" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="disCount" label="已发数量/件" width="120" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="cardCount" label="已开单数量/件" width="120" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="cardCount" label="剩余数量/件" width="120" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="cardCount" label="公司库存/件" width="120" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="cardCount" label="可配库存/件" width="120" :resizable='false'></el-table-column>--}}
                                {{--</el-table>--}}
                                {{--<div class="pagination-box">--}}
                                    {{--<el-pagination @size-change="handleSizeChange5" :page-sizes="[10,50,100,200]" :page-size="10" @current-change="changePageSkip5" :current-page.sync="currentPage5" :total="total5" layout="sizes,prev, pager, next" background></el-pagination>--}}
                                {{--</div>--}}
                            {{--</el-tab-pane>--}}
                        </el-tabs>
                    </div>
                </div>
            </div>
        </div>
        <!-- /主体-->
    </div>
    <script>
        new Vue({
            el: '#shopInfos',
            data:{
                sizeGr:[],//尺码信息

                activeName2: 'first',
                company_id:'',//公司
//                getDatas:'', //起止时间
//                created_at:'', //起止时间存储变量


                girardDetails:[], //按款订发存明细
                total1:1,  //table总条数
                page1:10,//每页多少条
                currentPage1:1, //table当前页数

                girardNum1:'',//款号种类合计
                girardPeople:[], //按客户订发存明细
                total2:1,  //table总条数
                page2:10,//每页多少条
                currentPage2:1, //table当前页数

                girardNum2:'',//款号种类合计
                surplusInfo:[],//按类订发存分析
                total3:1,  //table总条数
                page3:10,//每页多少条
                currentPage3:1, //table当前页数

                girardNum3:'',//款号种类合计
                orderInfo:[],//客户订发存订单
                total4:1,  //table总条数
                page4:10,//每页多少条
                currentPage4:1, //table当前页数
                girardNum4:'',//款号种类合计

                underlingInfo:[],//下属店铺订发存清单
                total5:1,  //table总条数
                page5:10,//每页多少条
                currentPage5:1, //table当前页数
                girardNum5:'',//款号种类合计



                options1: [], //公司

                cateTwo:[],
            },
            mounted(){
                this.common();
                this.baseInfo();
                this.grabble1();
            },
            methods:{
                /*尺码数据*/
                common(){
                    var that=this;
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/distribution/sizeGroupHead',
                        data: {
                            type:1,
                        },
                        success: function (data) {
                            //console.log(data);
                            if(data.result.success){
                                that.sizeGr=data.content.vertical;
                            }else{
                                that.$notify.error({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                });
                            }
                        }
                    });
                },
                /*基本信息*/
                baseInfo(){
                    var that=this;
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/distribution/analysis-infos',
                        data: {
                            company:-1,
                        },
                        success: function (data) {
                            //console.log(data);
                            if(data.result.success){
                                that.company_id=data.content.company_id;
                                that.options1 = data.content.data;
                            }else{
                                that.$notify.error({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                });
                            }
                        }
                    });
                },
                /*时间*/
//                getTime(date){
//                    if(date==null){
//                        this.getDatas='';
//                        this.created_at ='';
//                    }else{
//                        this.getDatas=date;
//                        this.created_at =date[0]+' - '+date[1];
//                    }
//                },
                /*搜索*/
                sou(){
                    if(this.activeName2=='first'){
                        this.grabble1('reset');
                    }else if(this.activeName2=='second'){
                        this.grabble2('reset');
                    }else if(this.activeName2=='third'){
                        this.grabble3('reset');
                    }else if(this.activeName2=='fourth'){
                        this.grabble4('reset');
                    }else if(this.activeName2=='fifth'){
                        this.grabble5('reset');
                    }
                },
                /*重置*/
                resetSou(){
                    this.company_id=1;
                    if(this.activeName2=='first'){
                        this.grabble1('reset');
                    }else if(this.activeName2=='second'){
                        this.grabble2('reset');
                    }else if(this.activeName2=='third'){
                        this.grabble3('reset');
                    }else if(this.activeName2=='fourth'){
                        this.grabble4('reset');
                    }else if(this.activeName2=='fifth'){
                        this.grabble5('reset');
                    }
                },
//-----------------------------------
                /*按款订发存明细*/
                grabble1(type){
                    var that = this;
                    let skip;
                    if(type == 'reset'){
                        skip = 0;
                    }else{
                        skip = that.currentPage1-1;
                    }
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/order-inquire/order-send-storage',
                        data: {
                            skip:skip,
                            page1:that.page1,
                            company_id:that.company_id,
                            type:1,
                        },
                        success: function (data) {
                            console.log(data);
                            if(data.result.success){
                                that.girardDetails = data.content.data;
                                that.currentPage1 = data.content.skip;
                                that.total1 = data.content.total;
                            }else{
                                that.$notify({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                    duration: 0
                                });
                            }
                        }
                    });
                },
                /*总折扣,总金额*/
                getCou(money,n1,n2,n3){
                    if(money.indexOf("/")!=-1){
                        let priArr=money.split("/");
                        let disOne=(priArr[0]*n1);
                        let disTwo=(priArr[1]*n2);
                        return (Number(disOne) + Number(disTwo)).toFixed(2);
                    }else{
                        return (money*n3).toFixed(2);
                    }
                },
                /*按款订发存明细重置*/
                reset1(){
                    this.grabble1('reset');
                },
                /*按款订发存明细每页条数*/
                handleSizeChange1(val) {
                    this.page1=val;
                    this.grabble1('reset');
                    //console.log(`每页 ${val} 条`);
                },
                /*按款订发存明细分页*/
                changePageSkip1(val){
                    //console.log(val);
                    this.currentPage1 = val;
                    this.grabble1();
                },
                /*按款订发存明细合计*/
                getSummaries1(param) {
                    var that=this;
                    const { columns, data } = param;
                    const sums = [];
                    columns.forEach((column, index) => {
                        if (index === 0) {
                            sums[index] = '合计';
                            return;
                        }
                        const values = data.map(item => Number(item[column.property]));
                        switch (column.property) {
                            case 'sum_nums1':
                                sums[index] = values.reduce((prev, curr) => {
                                    const value = Number(curr);
                                    if (!isNaN(value)) {
                                        return prev + curr;
                                    } else {
                                        return prev;
                                    }
                                }, 0);
                                break;
                            case 'sum_nums2':
                                sums[index] = values.reduce((prev, curr) => {
                                    const value = Number(curr);
                                    if (!isNaN(value)) {
                                        return prev + curr;
                                    } else {
                                        return prev;
                                    }
                                }, 0);
                                break;
                            case 'sum_nums3':
                                sums[index] = values.reduce((prev, curr) => {
                                    const value = Number(curr);
                                    if (!isNaN(value)) {
                                        return prev + curr;
                                    } else {
                                        return prev;
                                    }
                                }, 0);
                                break;
                            case 'sum_nums4':
                                sums[index] = values.reduce((prev, curr) => {
                                    const value = Number(curr);
                                    if (!isNaN(value)) {
                                        return prev + curr;
                                    } else {
                                        return prev;
                                    }
                                }, 0);
                                break;
                            case 'sum_nums5':
                                sums[index] = values.reduce((prev, curr) => {
                                    const value = Number(curr);
                                    if (!isNaN(value)) {
                                        return prev + curr;
                                    } else {
                                        return prev;
                                    }
                                }, 0);
                                break;
                            case 'sum_nums6':
                                sums[index] = values.reduce((prev, curr) => {
                                    const value = Number(curr);
                                    if (!isNaN(value)) {
                                        return prev + curr;
                                    } else {
                                        return prev;
                                    }
                                }, 0);
                                break;
                            default:
                                break;
                        }
                    });
                    return sums
                },
                objectSpanMethod1({ row, column, rowIndex, columnIndex }) {
                    if (columnIndex ===  0 || columnIndex ===  1 || columnIndex ===  2 || columnIndex ===  3 || columnIndex ===  4 || columnIndex ===  5 || columnIndex ===  6 || columnIndex ===  7) {
                        // 合并第一列
                        if (rowIndex === 0 || rowIndex === 6 || rowIndex === 12 || rowIndex === 18 || rowIndex === 24 || rowIndex === 30 || rowIndex === 36 || rowIndex === 42 || rowIndex === 48 || rowIndex === 54 || rowIndex === 60) {
                            // 从第一行开始
                            return {
                                rowspan: 6,//行
                                colspan: 1 //列
                            };
                        } else {
                            return {
                                rowspan: 0,
                                colspan: 0
                            };
                        }
                    }
                },
    //-----------------------------------
                /*按客户订发存明细列表*/
                grabble2(type){
                    var that = this;
                    let skip;
                    if(type == 'reset'){
                        skip = 0;
                    }else{
                        skip = that.currentPage2-1;
                    }
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/order-inquire/order-send-storage',
                        data: {
                            skip:skip,
                            page2:that.page2,
                            company_id:that.company_id,
                            type:2,
                        },
                        success: function (data) {
                            console.log(data);
                            if(data.result.success){
                                that.girardPeople = data.content.data;
                                that.currentPage2 = data.content.skip;
                                that.total2 = data.content.total;
                            }else{
                                that.$notify({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                    duration: 0
                                });
                            }
                        }
                    });
                },
                /*按客户订发存明细重置*/
                reset2(){
                    this.grabble2('reset');
                },
                /*按客户订发存明细每页条数*/
                handleSizeChange2(val) {
                    this.page2=val;
                    this.grabble2('reset');
                    //console.log(`每页 ${val} 条`);
                },
                /*按客户订发存明细分页*/
                changePageSkip2(val){
                    //console.log(val);
                    this.currentPage2 = val;
                    this.grabble2();
                },
                /*按客户订发存明细合计*/
                getSummaries2(param){
                    var that=this;
                    const { columns, data } = param;
                    const sums = [];
                    columns.forEach((column, index) => {
                        if (index === 0) {
                            sums[index] = '合计';
                            return;
                        }
                        const values = data.map(item => Number(item[column.property]));
                        switch (column.property) {
                            case 'sum_nums1':
                                sums[index] = values.reduce((prev, curr) => {
                                    const value = Number(curr);
                                    if (!isNaN(value)) {
                                        return prev + curr;
                                    } else {
                                        return prev;
                                    }
                                }, 0);
                                break;
                            case 'sum_nums2':
                                sums[index] = values.reduce((prev, curr) => {
                                    const value = Number(curr);
                                    if (!isNaN(value)) {
                                        return prev + curr;
                                    } else {
                                        return prev;
                                    }
                                }, 0);
                                break;
                            case 'sum_nums3':
                                sums[index] = values.reduce((prev, curr) => {
                                    const value = Number(curr);
                                    if (!isNaN(value)) {
                                        return prev + curr;
                                    } else {
                                        return prev;
                                    }
                                }, 0);
                                break;
                            case 'sum_nums4':
                                sums[index] = values.reduce((prev, curr) => {
                                    const value = Number(curr);
                                    if (!isNaN(value)) {
                                        return prev + curr;
                                    } else {
                                        return prev;
                                    }
                                }, 0);
                                break;
                            default:
                                break;
                        }
                    });
                    return sums
                },
                objectSpanMethod2({ row, column, rowIndex, columnIndex }) {
                    if (columnIndex ===  0 || columnIndex ===  1 || columnIndex ===  2 || columnIndex ===  3 || columnIndex ===  4 || columnIndex ===  5 || columnIndex ===  6 || columnIndex ===  7 || columnIndex ===  8) {
                        // 合并第一列
                        if (rowIndex === 0 || rowIndex === 4 || rowIndex === 8 || rowIndex === 12 || rowIndex === 16 || rowIndex === 20 || rowIndex === 24 || rowIndex === 28 || rowIndex === 32 || rowIndex === 36 || rowIndex === 40) {
                            // 从第一行开始
                            return {
                                rowspan: 4,//行
                                colspan: 1 //列
                            };
                        } else {
                            return {
                                rowspan: 0,
                                colspan: 0
                            };
                        }
                    }
                },
//-----------------------------------
                /*按类订发存分析列表*/
                grabble3(type){
                    var that = this;
                    let skip;
                    if(type == 'reset'){
                        skip = 0;
                    }else{
                        skip = that.currentPage3-1;
                    }
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/order-inquire/order-send-storage',
                        data: {
                            skip:skip,
                            page3:that.page3,
                            company_id:that.company_id,
                            type:3,
                        },
                        success: function (data) {
                            //console.log(data);
                            if(data.result.success){
                                var st1=[];
                                for(var value of data.content.cate2){
                                    st1.push({
                                        'text':value.cate2,
                                        'arguments0':value.cate_alias+'0',
                                        'arguments1':value.cate_alias+'1',
                                        'arguments2':value.cate_alias+'2',
                                        'arguments3':value.cate_alias+'3',
                                        'arguments4':value.cate_alias+'4',
                                        'arguments5':value.cate_alias+'5',
                                    })
                                }
                                that.cateTwo=st1;
                                that.surplusInfo = data.content.data;
                                that.currentPage3 = data.content.skip;
                                that.total3 = data.content.total;
                            }else{
                                that.$notify({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                    duration: 0
                                });
                            }
                        }
                    });
                },
                /*颜色*/
                handlemyclass:function(row, column, rowIndex, columnIndex){
                    //console.log(row, column, rowIndex, columnIndex);
                    //console.log(row.column.label)
                    if(row.column.label=='订货量/件' || row.column.label=='订货额/元'){
                        return 'bgPink'
                    }else if(row.column.label=='发货量/件' || row.column.label=='发货额/元'){
                        return 'bgBlue'
                    }else if(row.column.label=='剩余量/件' || row.column.label=='剩余额/元'){
                        return 'bgRed'
                    }
                },
                /*按类订发存分析重置*/
                reset3(){
                    this.grabble3('reset');
                },
                /*按类订发存分析每页条数*/
                handleSizeChange3(val) {
                    this.page3=val;
                    this.grabble3('reset');
                    //console.log(`每页 ${val} 条`);
                },
                /*按类订发存分析分页*/
                changePageSkip3(val){
                    //console.log(val);
                    this.currentPage3 = val;
                    this.grabble3();
                },
                /*按类订发存分析合计*/
                getSummaries3(param){
                    const { columns, data } = param;
                    const sums = [];
                    columns.forEach((column, index) => {
                        if (index === 0) {
                            sums[index] = '合计';
                            return;
                        }
                        const values = data.map(item => Number(item[column.property]));
                        if (!values.every(value => isNaN(value))) {
                            sums[index] = values.reduce((prev, curr) => {
                                const value = Number(curr);
                                if (!isNaN(value)) {
                                    return ( parseFloat(prev) + parseFloat(curr) ).toFixed(2);
                                } else {
                                    return parseFloat(prev).toFixed(2);
                                }
                            }, 0);
                        } else {
                            sums[index] = '';
                        }
                    });
                    return sums;
                },
//------------------------------------
                /*客户订发存订单列表*/
                grabble4(type){
                    var that = this;
                    let skip;
                    if(type == 'reset'){
                        skip = 0;
                    }else{
                        skip = that.currentPage4-1;
                    }
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/order-inquire/order-send-storage',
                        data: {
                            skip:skip,
                            page4:that.page4,
                            company_id:that.company_id,
                            type:4,
                        },
                        success: function (data) {
                            console.log(data);
                            if(data.result.success){
                                var opt=[];
                                let girardArr=[];
                                let i = 0;
                                for(var value of data.content.data){
                                    if(girardArr.indexOf(value.girard)==-1){
                                        girardArr.push(value.girard)
                                    };
                                    i++;
                                    opt.push({
                                        'id':value.id,
                                        'loop':i+(Number(that.page4)*skip),
                                        'client':value.client,
                                        'cate_1':value.cate_1,
                                        'cate_2':value.cate_2,
                                        'cate_3':value.cate_3,
                                        'brand':value.brand,
                                        'girard':value.girard,
                                        'color':value.color,

                                        'size':value.size,
                                        'order_num':value.order_num,
                                        'send_num':value.send_num,
                                        'kai_num':value.kai_num,
                                        'sheng_num':value.sur_num,
                                        'storage_num':value.storage_num,
                                        'sur_num':value.sur_num,
                                    })
                                }
                                that.girardNum4=girardArr.length;
                                that.orderInfo = opt;
                                that.currentPage4 = data.content.skip;
                                that.total4 = data.content.total;
                            }else{
                                that.$notify({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                    duration: 0
                                });
                            }
                        }
                    });
                },
                /*客户订发存订单重置*/
                reset4(){
                    this.grabble4('reset');
                },
                /*客户订发存订单条数*/
                handleSizeChange4(val) {
                    this.page4=val;
                    this.grabble4('reset');
                    //console.log(`每页 ${val} 条`);
                },
                /*客户订发存订单分页*/
                changePageSkip4(val){
                    //console.log(val);
                    this.currentPage4 = val;
                    this.grabble4();
                },
                /*客户订发存订单合计*/
                getSummaries4(param){
                    var that=this;
                    const { columns, data } = param;
                    const sums = [];
                    columns.forEach((column, index) => {
                        if (index === 0) {
                            sums[index] = '合计';
                            return;
                        }
                        const values = data.map(item => Number(item[column.property]));
                        switch (column.property) {
                            case 'girard':
                                sums[index] = that.girardNum4;
                                break;
                            case 'count':
                                sums[index] = values.reduce((prev, curr) => {
                                    const value = Number(curr);
                                    if (!isNaN(value)) {
                                        return prev + curr;
                                    } else {
                                        return prev;
                                    }
                                }, 0);
                                break;
                            case 'disCount':
                                sums[index] = values.reduce((prev, curr) => {
                                    const value = Number(curr);
                                    if (!isNaN(value)) {
                                        return ( parseFloat(prev) + parseFloat(curr) ).toFixed(2);
                                    } else {
                                        return parseFloat(prev).toFixed(2);
                                    }
                                }, 0);
                                break;
                            case 'cardCount':
                                sums[index] = values.reduce((prev, curr) => {
                                    const value = Number(curr);
                                    if (!isNaN(value)) {
                                        return ( parseFloat(prev) + parseFloat(curr) ).toFixed(2);
                                    } else {
                                        return parseFloat(prev).toFixed(2);
                                    }
                                }, 0);
                                break;
                            default:
                                break;
                        }
                    });
                    return sums
                },
//------------------------------------
                /*下属店铺订发存清单列表*/
//                grabble5(type){
//                    var that = this;
//                    let skip;
//                    if(type == 'reset'){
//                        skip = 0;
//                    }else{
//                        skip = that.currentPage5-1;
//                    }
//                    $.ajax({
//                        headers: {
//                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
//                        },
//                        type: 'post',
//                        url: '/order-inquire/',
//                        data: {
//                            skip:skip,
//                            page5:that.page5,
//                            company_id:that.company_id,
//                            type:5,
//                        },
//                        success: function (data) {
//                            console.log(data);
//                            if(data.result.success){
//                                var opt=[];
//                                let girardArr=[];
//                                let i = 0;
//                                for(var value of data.content.data){
//                                    if(girardArr.indexOf(value.girard)==-1){
//                                        girardArr.push(value.girard)
//                                    };
//                                    var cvs=0;
//                                    for(var cv=0;cv<value.nums.length;cv++){
//                                        if(value.nums[cv]==''){
//                                            value.nums[cv]=0;
//                                        }
//                                        cvs+=Number(value.nums[cv]);
//                                    }
//                                    var oneNum=0;
//                                    var twoNum=0;
//                                    if(value.nums.length==9 && value.price.indexOf("/")!=-1){
//                                        for(var cc=0;cc<value.nums.length;cc++){
//                                            if(value.nums[cc]==''){
//                                                value.nums[cc]=0;
//                                            }
//                                            if(cc<7){
//                                                oneNum+=Number(value.nums[cc]);
//                                            }else{
//                                                twoNum+=Number(value.nums[cc]);
//                                            }
//                                        }
//                                    }
//                                    i++;
//                                    opt.push({
//                                        'id':value.id,
//                                        'loop':i+(Number(that.page5)*skip),
//                                        'order_num':value.order_num,
//                                        'client_name':value.client_name,
//                                        'cate_1':value.cate_1,
//                                        'cate_3':value.cate_3,
//                                        'brand':value.brand,
//                                        'girard':value.girard,
//                                        'color':value.color,
//                                        'year':value.year,
//                                        'season':value.season,
//                                        'price':value.price,
//                                        'disPrice':value.discount_price,
//                                        'discount':value.discount,
//                                        'size_group':value.size_group,
//                                        'num':value.nums,
//                                        'count':cvs,
//                                        'disCount':that.getCou( value.discount_price , oneNum , twoNum , cvs),
//                                        'cardCount':that.getCou(value.price , oneNum , twoNum , cvs),
//
//                                    })
//                                }
//                                that.girardNum4=girardArr.length;
//                                that.orderInfo = opt;
//                                that.currentPage4 = data.content.skip;
//                                that.total4 = data.content.total;
//                            }else{
//                                that.$notify({
//                                    title: '提示',
//                                    message: data.result.errorMsg,
//                                    duration: 0
//                                });
//                            }
//                        }
//                    });
//                },
                /*下属店铺订发存清单重置*/
//                reset5(){
//                    this.grabble5('reset');
//                },
                /*下属店铺订发存清单条数*/
//                handleSizeChange5(val) {
//                    this.page5=val;
//                    this.grabble5('reset');
//                    //console.log(`每页 ${val} 条`);
//                },
                /*下属店铺订发存清单分页*/
//                changePageSkip5(val){
//                    //console.log(val);
//                    this.currentPage5 = val;
//                    this.grabble5();
//                },
                /*下属店铺订发存清单合计*/
//                getSummaries5(param){
//                    var that=this;
//                    const { columns, data } = param;
//                    const sums = [];
//                    columns.forEach((column, index) => {
//                        if (index === 0) {
//                            sums[index] = '合计';
//                            return;
//                        }
//                        const values = data.map(item => Number(item[column.property]));
//                        switch (column.property) {
//                            case 'girard':
//                                sums[index] = that.girardNum5;
//                                break;
//                            case 'count':
//                                sums[index] = values.reduce((prev, curr) => {
//                                    const value = Number(curr);
//                                    if (!isNaN(value)) {
//                                        return prev + curr;
//                                    } else {
//                                        return prev;
//                                    }
//                                }, 0);
//                                break;
//                            case 'disCount':
//                                sums[index] = values.reduce((prev, curr) => {
//                                    const value = Number(curr);
//                                    if (!isNaN(value)) {
//                                        return ( parseFloat(prev) + parseFloat(curr) ).toFixed(2);
//                                    } else {
//                                        return parseFloat(prev).toFixed(2);
//                                    }
//                                }, 0);
//                                break;
//                            case 'cardCount':
//                                sums[index] = values.reduce((prev, curr) => {
//                                    const value = Number(curr);
//                                    if (!isNaN(value)) {
//                                        return ( parseFloat(prev) + parseFloat(curr) ).toFixed(2);
//                                    } else {
//                                        return parseFloat(prev).toFixed(2);
//                                    }
//                                }, 0);
//                                break;
//                            default:
//                                break;
//                        }
//                    });
//                    return sums
//                },



                /*点击切换tab*/
                handleClick(tab, event) {
                    if(tab.name=='first'){
                        this.grabble1('reset');
                    }else if(tab.name=='second'){
                        this.grabble2('reset');
                    }else if(tab.name=='third'){
                        this.grabble3('reset');
                    }else if(tab.name=='fourth'){
                        this.grabble4('reset');
                    }else if(tab.name=='fifth'){
                        this.grabble5('reset');
                    }
                },
            },
        });
    </script>
@endsection
